<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" href="../css/style2.css">
    <style>
    .notA a {
        color: #000;
    }

    /*加号*/
    .add_div {
        float: right;
        margin-right: -10px;
        margin-top: 3px;
        width: 26px;
        height: 26px;
        line-height: 26px;
        text-align: center;
        border: 1px solid #ccc;
        cursor: pointer;
        -webkit-transition: .4s all;
        transition: .4s all;
    }

    .add_div:hover {
        border: 1px solid #999;
    }

    /*小图片*/
    .img_pocket {
        height: 28px;
        cursor: pointer;
    }

    .layui-layer-btn0 {
        border-color: #20c0c7 !important;
        background-color: #20c0c7 !important;
    }

    .layui-layer-btn1,
    .layui-layer-btn2 {
        color: #333 !important;
    }

    #menu>li.container:hover {
        background-color: #ffffff;
    }

    .layui-tab>.layui-tab-title {
        overflow: hidden;
    }

    .unfold {
        width: 30px;
        height: 100%;
        background: #f5f5f5;
        position: absolute;
        top: 0px;
        right: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        cursor: pointer;
        transition: all 0.2s linear;
        display: none;
    }

    .unfold:hover {
        background: #dedede;
    }
    </style>
    <link rel="stylesheet" type="text/css" href="../layui/css/layui.css">
    <script src="../js/jquery.js"></script>
    <script type="text/javascript" src="../layui/layui.js"></script>
</head>

<body>
    <div class="layui-tab-content">
        <div class="layui-tab-item layui-show">
            <div class="flip-switchTC">
                <div id="CardiovascularStatusTable">
                    <div>
                        <table class="layui-hide" id="CardiovascularStatus_n" lay-filter="test"></table>
                    </div>
                    <div class='box box_l' style='font-weight: 600;margin-top:25px;'><i class='circle' style='background:#666;'>!</i>历史血液检查记录</div>
                    <div>
                        <table class="layui-hide" id="CardiovascularStatus_f" lay-filter="test"></table>
                    </div>
                </div>
                <div id="CardiovascularStatusChart">
                </div>
            </div>
        </div>
    </div>
</body>
<script type="text/javascript">
var urlS = "http://27.150.171.149:2023";
var highLowList = null;

function getHighLowList() {
    $.ajax({
        type: "get",
        async: false,
        url: urlS + "/person/inspect/all_index_range/",
        dataType: "json",
        timeout: 3000,
        success: function(data) {
            if (!data.code) {
                highLowList = data.data;
            }
        },
        error: function(err) {
            console.log(err);
        }
    });
}
// getHighLowList();

function highLow(nmber, field) {
    if (!nmber || !field) {
        return "";
    }
    var span = '<span>' + nmber + '</span>';
    if (!highLowList || !highLowList[field]) {
        return span;
    }
    if (highLowList[field].range_min > nmber) {
        span = '<span class="excessiveLow">' + nmber + '<i class="fa fa-long-arrow-down"></i></span>';
    } else if (highLowList[field].range_max < nmber) {
        span = '<span class="overtop">' + nmber + '<i class="fa fa-long-arrow-up"></i></span>';
    }
    return span;
}
</script>
<script type="text/html" id="CardiovascularStatusOP"><!-- 心血管状态 -->
      <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del" data-type='del' tabId='CardiovascularStatus' url='/bloodexamination/{{d.id}}/' style='color:#fff;'>删除</a>
      <a class="layui-btn layui-btn-xs" lay-event="update" data-type="cardiovascularStatus" ifnew='false' obj='{{JSON.stringify(d)}}' registernumber='t' tabId='CardiovascularStatus' url='/bloodexamination/{{d.id}}/' style='color:#fff;'>修改</a>
</script>
<script type="text/html" id="CardiovascularStatusDemo">
    <b style='font-weight: 600;'><i class='circle' style='background:#666;margin-top:6px;'>!</i>今日血液检查记录</b>
        <div class='add_div' data-type='cardiovascularStatus' ifnew='true' registernumber='t' title='新增血液检查记录'><i class="layui-icon layui-icon-add-circle"></i></div>
    </script>
<script type="text/html" id="glycated_hemeTpl">
    {{ highLow(d.glycated_heme,"glycated_heme") }}
</script>
<script type="text/html" id="HDLTpl">
    {{ highLow(d.HDL,"HDL") }}
</script>
<script type="text/html" id="LDLTpl">
    {{ highLow(d.LDL,"LDL") }}
</script>
<script type="text/html" id="befor_meals_blood_sugarTpl">
    {{ highLow(d.befor_meals_blood_sugar,"befor_meals_blood_sugar") }}
</script>
<script type="text/html" id="after_meals_blood_sugarTpl">
    {{ highLow(d.after_meals_blood_sugar,"after_meals_blood_sugar") }}
</script>
<script type="text/html" id="creatinineTpl">
    {{ highLow(d.creatinine,"creatinine") }}
</script>
<script type="text/html" id="albuminTpl">
    {{ highLow(d.albumin,"albumin") }}
</script>
<script type="text/html" id="urea_nitrogenTpl">
    {{ highLow(d.urea_nitrogen,"urea_nitrogen") }}
</script>
<script type="text/html" id="total_cholesterolTpl">
    {{ highLow(d.total_cholesterol,"total_cholesterol") }}
</script>
<script type="text/html" id="uric_acidTpl">
    {{ highLow(d.uric_acid,"uric_acid") }}
</script>
<script type="text/html" id="triglycerideTpl">
    {{ highLow(d.triglyceride,"triglyceride") }}
</script>
<script type="text/html" id="liver_function_leftTpl">
    {{ highLow(d.liver_function_left,"liver_function_left") }}
</script>
<script type="text/html" id="liver_function_rightTpl">
    {{ highLow(d.liver_function_right,"liver_function_right") }}
</script>
<!-- 单基因检查 -->
<script type="text/html" id='single_gene_detectionTpl'>
    {{#  if(d.single_gene_detection == 0){ }}无突变
    {{#  } else if(d.single_gene_detection == 1){ }}检测到突变
    {{#  } else if(d.single_gene_detection == 2){ }}MODY 1-5
    {{#  } }}
</script>
<!-- 抗体 -->
<script type="text/html" id='antibodyTpl'>
    {{#  if(d.antibody == 0){ }}Anti IA2 阳性
    {{#  } else if(d.antibody == 1){ }}Anti IA2 阴性
    {{#  } else if(d.antibody == 2){ }}Anti-GAD 阳性
    {{#  } else if(d.antibody == 3){ }}Anti-GAD 阴性
    {{#  } }}
</script>
<script type="text/javascript">
$(document).ready(function() {
    layui.jquery.ajaxSetup({
        headers: { "Authorization": 'JWT ' + "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VybmFtZSI6ImFkbWluIiwiZXhwIjoxNjA4NTM1NDkyLCJlbWFpbCI6IjQ2NTQ1NkBxcS5jb20ifQ.FVHlx0saZuHr-vKSlkTmWT1LZ4Mh2oEHbgnhDuizYZQ" }
    });
});

layui.use('element', function() {
    var element = layui.element;
});
layui.use('table', function() {
    var table = layui.table;
    table.render({
        elem: '#CardiovascularStatus_n',
        height: 'auto',
        toolbar: '#CardiovascularStatusDemo',
        url: urlS + '/bloodexamination/',
        where: { type: 'n', patient_id: 1106 },
        method: '',
        page: false,
        cols: [
            [
                { field: 'create_time', title: '创建日期', width: '120', sort: true, align: 'center' }, { field: 'inspection_date', title: '化验日期', width: '120', align: 'center' }, { field: 'glycated_heme', title: '<span class="myCursorP" onclick="brokenLineF(`CardiovascularStatus`,`glycated_heme`);">糖化血红素(%) <i class="fa fa-area-chart"></i></span>', width: '160', align: 'center', templet: '#glycated_hemeTpl' }, { field: 'HDL', title: '<span class="myCursorP" onclick="brokenLineF(`CardiovascularStatus`,`HDL`);">高密度脂蛋白(mg/dl) <i class="fa fa-area-chart"></i></span>', width: '160', align: 'center', templet: '#HDLTpl' }, { field: 'LDL', title: '<span class="myCursorP" onclick="brokenLineF(`CardiovascularStatus`,`LDL`);">低密度脂蛋白(mg/dl) <i class="fa fa-area-chart"></i></span>', width: '160', align: 'center', templet: '#LDLTpl' }, { field: 'befor_meals_blood_sugar', title: '<span class="myCursorP" onclick="brokenLineF(`CardiovascularStatus`,`befor_meals_blood_sugar`);">饭前血糖值(mg/dl) <i class="fa fa-area-chart"></i></span>', width: '160', align: 'center', templet: '#befor_meals_blood_sugarTpl' }, { field: 'after_meals_blood_sugar', title: '<span class="myCursorP" onclick="brokenLineF(`CardiovascularStatus`,`after_meals_blood_sugar`);">饭后血糖值(mg/dl) <i class="fa fa-area-chart"></i></span>', width: '160', align: 'center', templet: '#after_meals_blood_sugarTpl' }, { field: 'creatinine', title: '<span class="myCursorP" onclick="brokenLineF(`CardiovascularStatus`,`creatinine`);">肌酸酐(mg/dl) <i class="fa fa-area-chart"></i></span>', width: '160', align: 'center', templet: '#creatinineTpl' }, { field: 'albumin', title: '<span class="myCursorP" onclick="brokenLineF(`CardiovascularStatus`,`albumin`);">白蛋白(G/dl)) <i class="fa fa-area-chart"></i></span>', width: '160', align: 'center', templet: '#albuminTpl' }, { field: 'urea_nitrogen', title: '<span class="myCursorP" onclick="brokenLineF(`CardiovascularStatus`,`urea_nitrogen`);">尿素氮(mg/dl) <i class="fa fa-area-chart"></i></span>', width: '160', align: 'center', templet: '#urea_nitrogenTpl' }, { field: 'total_cholesterol', title: '<span class="myCursorP" onclick="brokenLineF(`CardiovascularStatus`,`total_cholesterol`);">总胆固醇(mg/dl) <i class="fa fa-area-chart"></i></span>', width: '160', align: 'center', templet: '#total_cholesterolTpl' }, { field: 'uric_acid', title: '<span class="myCursorP" onclick="brokenLineF(`CardiovascularStatus`,`uric_acid`);">尿酸(mg/dl) <i class="fa fa-area-chart"></i></span>', width: '160', align: 'center', templet: '#uric_acidTpl' }, { field: 'triglyceride', title: '<span class="myCursorP" onclick="brokenLineF(`CardiovascularStatus`,`triglyceride`);">三酸甘油酯(mg/dl) <i class="fa fa-area-chart"></i></span>', width: '160', align: 'center', templet: '#triglycerideTpl' }, { field: 'liver_function_left', title: '<span class="myCursorP" onclick="brokenLineF(`CardiovascularStatus`,`liver_function_left`);">肝功能检查左(u/l) <i class="fa fa-area-chart"></i></span>', width: '160', align: 'center', templet: '#liver_function_leftTpl' }, { field: 'liver_function_right', title: '<span class="myCursorP" onclick="brokenLineF(`CardiovascularStatus`,`liver_function_right`);">肝功能检查右(u/l) <i class="fa fa-area-chart"></i></span>', width: '160', align: 'center', templet: '#liver_function_rightTpl' }, { field: 'single_gene_detection', title: '单基因检查', width: '120', align: 'center', templet: '#single_gene_detectionTpl' }, { field: 'antibody', title: '抗体', width: '120', align: 'center', templet: '#antibodyTpl' }, { field: 'other_examination', title: '其他', width: '120', align: 'center' }, { title: '操作', width: '120', align: 'center', toolbar: '#CardiovascularStatusOP' }
            ]
        ],
        done: function(res, curr, count) {}
    });
    table.render({
        elem: '#CardiovascularStatus_f',
        height: 'auto',
        url: urlS + '/bloodexamination/',
        where: { type: 'f', patient_id: 1106 },
        method: '',
        page: true,
        cols: [
            [
                { field: 'create_time', title: '创建日期', width: '120', sort: true, align: 'center' }, { field: 'inspection_date', title: '化验日期', width: '120', align: 'center' }, { field: 'glycated_heme', title: '<span class="myCursorP" onclick="brokenLineF(`CardiovascularStatus`,`glycated_heme`);">糖化血红素(%) <i class="fa fa-area-chart"></i></span>', width: '160', align: 'center', templet: '#glycated_hemeTpl' }, { field: 'HDL', title: '<span class="myCursorP" onclick="brokenLineF(`CardiovascularStatus`,`HDL`);">高密度脂蛋白(mg/dl) <i class="fa fa-area-chart"></i></span>', width: '160', align: 'center', templet: '#HDLTpl' }, { field: 'LDL', title: '<span class="myCursorP" onclick="brokenLineF(`CardiovascularStatus`,`LDL`);">低密度脂蛋白(mg/dl) <i class="fa fa-area-chart"></i></span>', width: '160', align: 'center', templet: '#LDLTpl' }, { field: 'befor_meals_blood_sugar', title: '<span class="myCursorP" onclick="brokenLineF(`CardiovascularStatus`,`befor_meals_blood_sugar`);">饭前血糖值(mg/dl) <i class="fa fa-area-chart"></i></span>', width: '160', align: 'center', templet: '#befor_meals_blood_sugarTpl' }, { field: 'after_meals_blood_sugar', title: '<span class="myCursorP" onclick="brokenLineF(`CardiovascularStatus`,`after_meals_blood_sugar`);">饭后血糖值(mg/dl) <i class="fa fa-area-chart"></i></span>', width: '160', align: 'center', templet: '#after_meals_blood_sugarTpl' }, { field: 'creatinine', title: '<span class="myCursorP" onclick="brokenLineF(`CardiovascularStatus`,`creatinine`);">肌酸酐(mg/dl) <i class="fa fa-area-chart"></i></span>', width: '160', align: 'center', templet: '#creatinineTpl' }, { field: 'albumin', title: '<span class="myCursorP" onclick="brokenLineF(`CardiovascularStatus`,`albumin`);">白蛋白(G/dl)) <i class="fa fa-area-chart"></i></span>', width: '160', align: 'center', templet: '#albuminTpl' }, { field: 'urea_nitrogen', title: '<span class="myCursorP" onclick="brokenLineF(`CardiovascularStatus`,`urea_nitrogen`);">尿素氮(mg/dl) <i class="fa fa-area-chart"></i></span>', width: '160', align: 'center', templet: '#urea_nitrogenTpl' }, { field: 'total_cholesterol', title: '<span class="myCursorP" onclick="brokenLineF(`CardiovascularStatus`,`total_cholesterol`);">总胆固醇(mg/dl) <i class="fa fa-area-chart"></i></span>', width: '160', align: 'center', templet: '#total_cholesterolTpl' }, { field: 'uric_acid', title: '<span class="myCursorP" onclick="brokenLineF(`CardiovascularStatus`,`uric_acid`);">尿酸(mg/dl) <i class="fa fa-area-chart"></i></span>', width: '160', align: 'center', templet: '#uric_acidTpl' }, { field: 'triglyceride', title: '<span class="myCursorP" onclick="brokenLineF(`CardiovascularStatus`,`triglyceride`);">三酸甘油酯(mg/dl) <i class="fa fa-area-chart"></i></span>', width: '160', align: 'center', templet: '#triglycerideTpl' }, { field: 'liver_function_left', title: '<span class="myCursorP" onclick="brokenLineF(`CardiovascularStatus`,`liver_function_left`);">肝功能检查左(u/l) <i class="fa fa-area-chart"></i></span>', width: '160', align: 'center', templet: '#liver_function_leftTpl' }, { field: 'liver_function_right', title: '<span class="myCursorP" onclick="brokenLineF(`CardiovascularStatus`,`liver_function_right`);">肝功能检查右(u/l) <i class="fa fa-area-chart"></i></span>', width: '160', align: 'center', templet: '#liver_function_rightTpl' }, { field: 'single_gene_detection', title: '单基因检查', width: '120', align: 'center', templet: '#single_gene_detectionTpl' }, { field: 'antibody', title: '抗体', width: '120', align: 'center', templet: '#antibodyTpl' }, { field: 'other_examination', title: '其他', width: '120', align: 'center' }, { title: '操作', width: '120', align: 'center', toolbar: '#CardiovascularStatusOP' }
            ]
        ],
        done: function(res, curr, count) {}
    });
})
</script>

</html>